package com.syqc.login

import android.app.Application
import android.content.Context
import com.kingja.loadsir.core.LoadSir
import com.syqc.comlib.appstate.AppStatus
import com.syqc.comlib.appstate.AppStatusManger
import com.syqc.comlib.callback.EmptyCallback
import com.syqc.comlib.callback.ErrorCallback
import com.syqc.comlib.network.NetChangerReceiver
import com.syqc.comlib.utils.AppContext
import com.syqc.comlib.utils.BuildConfigs
import com.syqc.comlib.utils.CacheMMKV
import com.syqc.comlib.utils.Language
import com.syqc.net.Net
import kotlin.concurrent.thread

/** @author joker @date 2022/8/26$ 17:28$ */
object Init {
    fun initUtil(appContext: Application) {
        CacheMMKV.init(appContext)
        Language.init(appContext)
        thread {
            Net.init(BuildConfigs.DEBUG)
            AppContext.setAppContext(appContext)
            NetChangerReceiver.init(appContext)
            LoadSir.beginBuilder()
                .addCallback(EmptyCallback())
                .addCallback(ErrorCallback())
                .commit()
            AppStatusManger.instance.mAppStatus = AppStatus.STATUS_NORMAL
        }
    }
}